package com.lam.mall.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lam.common.base.domain.BaseEntity;
import com.lam.common.components.dict.annotation.Dict;
import com.lam.common.components.dict.constant.DictTypeEnum;
import com.lam.common.utils.DateUtil;
import com.lam.common.validate.annotation.DictCheck;
import com.lam.common.validate.annotation.DictValid;
import com.lam.common.validate.group.Add;

/**
 * 订单管理对象 mall_order
 * 
 * @author admin
 * @date 2023-04-25
 */
@DictCheck
@TableName("mall_order")
public class Order implements BaseEntity{

    /** 主键 */
    @Null(groups = Add.class, message="id必须为空")
    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    
    /** 店铺id */
    private String shopId;

    /** 产品名称,多个产品将会以逗号隔开 */
    @NotBlank(message = "产品名称不能为空")
    @Size(max = 1000, message = "产品名称不能超过1000个字符")
    private String prodName;

    /** 订购用户ID */
    @NotBlank(message = "订购用户ID不能为空")
    @Size(max = 36, message = "订购用户ID长度不能超过36个字符")
    private String userId;

    /** 订购流水号 */
    @NotBlank(message = "订购流水号不能为空")
    @Size(max = 50, message = "订购流水号长度不能超过50个字符")
    private String orderNumber;

    /** 商品总额 */
    @ExcelProperty("商品总额")
    @NotNull(message = "商品总额不能为空")
    private BigDecimal total;

    /** 优惠总额 */
    private BigDecimal reduceAmount;

    /** 订单金额 */
    private BigDecimal actualTotal;

    /** 支付方式 (0-手动代付 1-微信支付 2-支付宝) */
    @DictValid(message = "无效的支付方式 ")
    @Dict(dictCode = "pay_type")
    private Integer payType;

    /** 支付金额 */
    private BigDecimal payAmt;

    /** 订单备注 */
    @Size(max = 1024, message = "订单备注长度不能超过1024个字符")
    private String remarks;

    /** 订单状态 (1-待付款, 2-待发货,3-待收货,4-待评价,5-成功,6-关闭) */
    @NotNull(message = "订单状态 不能为空")
    @DictValid(message = "无效的订单状态 ")
    @Dict(dictCode = "order_status")
    private Integer status;

    /** 配送类型 */
    @Size(max = 10, message = "配送类型长度不能超过10个字符")
    @DictValid(message = "无效的配送类型")
    @Dict(dictCode = "delivery_mode")
    private String dvyType;

    /** 配送公司ID */
    @DictValid(message = "配送配送公司")
    @Dict(dictCode = "delivery", dictType = DictTypeEnum.TABLE_DICT)
    private String dvyId;

    /** 配送运单号 */
    @Size(max = 100, message = "配送运单号长度不能超过100个字符")
    private String dvyFlowNo;

    /** 配送运费 */
    private BigDecimal dvyAmount;

    /** 收货地址Id */
    private String orderAddrId;

    /** 购买商品总数 */
    private Integer productNums;

    /** 下单时间 */
    @ExcelIgnore
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /** 更新时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    /** 截止有效时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    private Date expTime;
    
    /** 付款时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    private Date payTime;

    /** 发货时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    private Date dvyTime;

    /** 完成时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    private Date finallyTime;

    /** 取消时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    private Date cancelTime;

    /** 是否已经支付，(1-已经支付过，0-没有支付过) */
    @DictValid(message = "无效的是否已经支付，")
    @Dict(dictCode = "is_payed_type")
    private Integer isPayed;

    /** 订单删除状态，(1-没有删除， 0-回收站， 2-永久删除) */
    @DictValid(message = "无效的订单删除状态，")
    @Dict(dictCode = "delete_status")
    private Integer deleteStatus;

    /** 退款状态, (0-默认,1-在处理,2-处理完成) */
    @DictValid(message = "无效的退款状态, ")
    @Dict(dictCode = "refund_status")
    private Integer refundSts;

    /** 订单类型 */
    private Integer orderType;

    /** 订单关闭原因 （1-超时未支付 2-退款关闭 4-买家取消 5-货到付款交易） */
    @DictValid(message = "无效的订单关闭原因 ")
    @Dict(dictCode = "close_type")
    private Integer closeType;
    
    /** 店铺名称 */
    @TableField(exist = false)
    private String shopName;
    
    /** 店铺名称 */
    @TableField(exist = false)
    private List<OrderItem> orderItems;
    
    /** 用户订单地址 */
    @TableField(exist = false)
    private OrderAddr orderAddr;

    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    } 

    public void setShopId(String shopId) {
        this.shopId = shopId;
    }

    public String getShopId() {
        return shopId;
    }    
    
    public void setProdName(String prodName) {
        this.prodName = prodName;
    }

    public String getProdName() {
        return prodName;
    }    
    
    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserId() {
        return userId;
    }    
    
    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getOrderNumber() {
        return orderNumber;
    }    
    
    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    public BigDecimal getTotal() {
        return total;
    }    
    
    public void setReduceAmount(BigDecimal reduceAmount) {
        this.reduceAmount = reduceAmount;
    }

    public BigDecimal getReduceAmount() {
        return reduceAmount;
    }    
    
    public void setActualTotal(BigDecimal actualTotal) {
        this.actualTotal = actualTotal;
    }

    public BigDecimal getActualTotal() {
        return actualTotal;
    }    
    
    public void setPayType(Integer payType) {
        this.payType = payType;
    }

    public Integer getPayType() {
        return payType;
    }    
    
    public void setPayAmt(BigDecimal payAmt) {
        this.payAmt = payAmt;
    }

    public BigDecimal getPayAmt() {
        return payAmt;
    }    
    
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getRemarks() {
        return remarks;
    }    
    
    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }    
    
    public void setDvyType(String dvyType) {
        this.dvyType = dvyType;
    }

    public String getDvyType() {
        return dvyType;
    }    
    
    public void setDvyId(String dvyId) {
        this.dvyId = dvyId;
    }

    public String getDvyId() {
        return dvyId;
    }    
    
    public void setDvyFlowNo(String dvyFlowNo) {
        this.dvyFlowNo = dvyFlowNo;
    }

    public String getDvyFlowNo() {
        return dvyFlowNo;
    }    
    
    public void setDvyAmount(BigDecimal dvyAmount) {
        this.dvyAmount = dvyAmount;
    }

    public BigDecimal getDvyAmount() {
        return dvyAmount;
    }    
    
    public void setProductNums(Integer productNums) {
        this.productNums = productNums;
    }

    public Integer getProductNums() {
        return productNums;
    }    
    
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getCreateTime() {
        return createTime;
    }    
    
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }    
    
    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }

    public Date getPayTime() {
        return payTime;
    }    
    
    public void setDvyTime(Date dvyTime) {
        this.dvyTime = dvyTime;
    }

    public Date getDvyTime() {
        return dvyTime;
    }    
    
    public void setFinallyTime(Date finallyTime) {
        this.finallyTime = finallyTime;
    }

    public Date getFinallyTime() {
        return finallyTime;
    }    
    
    public void setCancelTime(Date cancelTime) {
        this.cancelTime = cancelTime;
    }

    public Date getCancelTime() {
        return cancelTime;
    }    
    
    public void setIsPayed(Integer isPayed) {
        this.isPayed = isPayed;
    }

    public Integer getIsPayed() {
        return isPayed;
    }    
    
    public void setDeleteStatus(Integer deleteStatus) {
        this.deleteStatus = deleteStatus;
    }

    public Integer getDeleteStatus() {
        return deleteStatus;
    }    
    
    public void setRefundSts(Integer refundSts) {
        this.refundSts = refundSts;
    }

    public Integer getRefundSts() {
        return refundSts;
    }    
    
    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public Integer getOrderType() {
        return orderType;
    }    
    
    public void setCloseType(Integer closeType) {
        this.closeType = closeType;
    }

    public Integer getCloseType() {
        return closeType;
    }

	public String getShopName() {
		return shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}

	public List<OrderItem> getOrderItems() {
		return orderItems;
	}

	public void setOrderItems(List<OrderItem> orderItems) {
		this.orderItems = orderItems;
	}

	public OrderAddr getOrderAddr() {
		return orderAddr;
	}

	public void setOrderAddr(OrderAddr orderAddr) {
		this.orderAddr = orderAddr;
	}

	public Date getExpTime() {
		return expTime;
	}

	public void setExpTime(Date expTime) {
		this.expTime = expTime;
	}

	public String getOrderAddrId() {
		return orderAddrId;
	}

	public void setOrderAddrId(String orderAddrId) {
		this.orderAddrId = orderAddrId;
	}    
    

}
